function main(defaultParams) {
    const self = this;
    debugger
    if (defaultParams.callbackParams) {
        var validFlag = defaultParams.callbackParams.data.root_8hq6z0.radio_4bwikf;
        var confiscatedCardInfoId = defaultParams.callbackParams.data.root_8hq6z0.number_input_bo160u;
        let approvalStateCode = 2;
        let approvalStateName = '';
        let card_state_code = 1;
        let stateCode = 1;
        // 审核是否通过
        if (validFlag == '1') {
            stateCode = 3;
            card_state_code = 2;
            approvalStateCode = 1;
            approvalStateName = '通过';
        } else {
            stateCode = 1
            card_state_code = 1;
            approvalStateName = '不通过';
        }

        var id = defaultParams.callbackParams.data.root_8hq6z0.number_input_bo160u;
        var update = "UPDATE('ds_tbl:t_78e3820cec034204b3ec0f507253f5de',QUERY_EQ('id','" + id + "'),'', ['state_code','" + stateCode + "','card_state_code','" + card_state_code + "','approval_state_code','" + approvalStateCode + "', 'approval_state_name',' " + approvalStateName + " ','issuance_time', NOW()])";
        api.EXEC_FORMULA(update).then((res) => {
            console.log(res);
            // 获取页面列表组件
            var pageListEle = self.$$("page_widget_list_f968i3");
            // 获取列表渲染页实例
            var listRenderView = pageListEle.$$getRenderElement();
            // 获取当前显示的组件，表格或者卡片
            var currentListEle = listRenderView.$$getListElement();
            // 调用刷新方法
            currentListEle.$$refreshData();
        });
    }


}

/**
 *  id 表标识
 *  confiscated_card_id 罚没证id
 *  unit_id 审批部门id',
 *  unit_name  审批部门名称',
 *  human_id 审批人员id',
 *  human_name  审批人员名称',
 *  approval_state_code  审批状态 0待审核 1 通过 2 不通过',
 *  opinion  '审批意见',
 *  approval_time   '审批时间',
 *  approval_type 申请类型 1 申请 2 变更 3 注销',
 * @param approvalData
 * @returns {Promise<never>|Promise<unknown>}
 */
function insertLawConfiscatedCardApprovalInfo(approvalData) {

    const insertLawConfiscatedCardApprovalInfoSql = [['confiscated_card_id', approvalData.confiscatedCardId], ['unit_id', "'" + approvalData.unitId + "'"], ['unit_name', "'" + approvalData.unitName + "'"], ['human_id', "'" + approvalData.humanId + "'"], ['human_name', "'" + approvalData.humanName + "'"], ['approval_state_code', "'" + approvalData.approvalStateCode + "'"], ['opinion', "'" + approvalData.opinion + "'"], ['approval_type', "'" + approvalData.approvalType + "'"], ['approval_time', 'NOW()']];

    let law_confiscated_card_approval_info = 'ds_tbl:t_d6d40a9fbcac40568e164e9976b35459';

    // 构建参数化INSERT语句
    const formattedFields = insertLawConfiscatedCardApprovalInfoSql.map(function (field) {
        return "'" + field[0] + "'," + field[1];
    });

    const insertSql = "INSERT('" + law_confiscated_card_approval_info + "', [" + formattedFields.join(',') + "])";
    console.log("准备执行的SQL语句:", insertSql);

    return new Promise(function (resolve, reject) {
        api.EXEC_FORMULA(insertSql)
            .then(function (res) {
                console.log("数据插入成功");
                resolve(res);
            })
            .catch(function (err) {
                console.error("数据插入失败:", err);
                reject(new Error(`审批记录插入失败: ${err.message}`));
            });
    });
}
